import { defineStore } from 'pinia'
// import type {} from 'xxx' //!引入某个类型，用来定义state的类型

//!或者单独定义类型
export interface UserStateModle {
  name: string
  face: string
  mid: number //相当于个人中心所需要的uid，在很多请求里面一时uid一时mid的，需要辨别
  dynamic_count: number //动态数
  follower: number //粉丝数
  following: number //关注数
}

export const useUserStore = defineStore({
  // 一定要有store的id，作为store模块的命名空间
  id: 'User',

  state: (): UserStateModle => ({
    name: '',
    face: '',
    mid: 0,
    dynamic_count: 0, //动态数
    follower: 0, //粉丝数
    following: 0, //关注数
  }),

  actions: {
    setUserName_Face(name: string, face: string, mid: number) {
      this.name = name
      this.face = face
      this.mid = mid
    },
    setUserCount(dynamic_count: number, follower: number, following: number) {
      this.dynamic_count = dynamic_count
      this.follower = follower
      this.following = following
    },
  },
})
